
package CtrlLayer;
import DomainLayer.*;

/**
 * This class is the controller class for the Product and ProductContainer classes.
 * @author Zsombi
 */
public class ProductCtrl
{
    ProductContainer products = new ProductContainer();

    /**
     * Empty constructor for the ProductCtrl class.
     */
    public ProductCtrl()
    {    }

    /**
     * Creates a Product object and adds it to the products ArrayList.
     * @param Id
     * @param Name
     * @param Amount
     * @param Price
     * @param Discount
     * @param Description
     */
    public void addProduct(String Id, String Name, int Amount, double Price, double Discount, String Description)
    {
        products.addProduct(new Product(Id, Name, Amount, Price, Discount, Description));
    }

    /**
     * Calls the deleteProduct method of the ProductContainer class.
     * Searches for a Product object by its Id.
     * If found, delete/remove that object from the products ArrayList.
     * @param productId
     */
    public void deleteProduct(String productId)
    {
        deleteProduct(productId);
    }

    /**
     * Calls the getProduct method of the ProductContainer class.
     * Searches for a Product object by its Id.
     * If found, returns that object from the products ArrayList.
     * @param productId
     * @return Product object
     */
    public Product getProduct(String productId)
    {
        return products.getProduct(productId);
    }

    /**
     * Calls the listProducts method of the ProductContainer class.
     * Lists the contents of the products ArrayList.
     */
    public void listProducts()
    {
        listProducts();
    }

    /**
     * Asks for a products Identification code (Id).
     * Calls the listProductDetails method of the ProductContainer class.
     * Searches for a Product object by its Identification code (Id).
     * If found, prints out all information about it.
     * @param productId
     */
    public void listProductDetails(String productId)
    {
        products.listProductDetails(productId);
    }
}
